package com.itheima05;

public class Cooker extends Thread{
    @Override
    public void run() {
     while (true){
         synchronized (Desk.lock){
             if(Desk.count==0){
                 break;
             }
             if(Desk.falg){
                 try {
                     Desk.lock.wait();
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
             }else{
                 System.out.println("生产者生产一个汉堡包");
                 Desk.falg=true;
                 Desk.lock.notifyAll();

             }
         }
     }
    }
}
